/**
 * Created by Administrator on 2017/6/10.
 */
var content=document.querySelector(".content");
three1=document.querySelector(".three");
var xhr=cohenLee.createXHR();
var url="http://localhost:6500/books";
xhr.open("get",url);
xhr.send(null);
xhr.onreadystatechange=function () {
    if(xhr.readyState==4){
        if(xhr.status>=200 && xhr.status<300 ||xhr.status==304){
            var data=JSON.parse(xhr.responseText);
            for(var i=0;i<data.length;i++){
                var three1 = document.createElement("div");
                three1.className="three";
                content.appendChild(three1);
                var img = document.createElement("img");
                img.src = data[i]["bookImage"];
                img.className="picture";
                three1.appendChild(img);
                var inifoDiv=document.createElement("div");
                inifoDiv.className="inifoDiv";
                three1.appendChild(inifoDiv);
                var p1=document.createElement("p");
                p1.className="name";
                inifoDiv.appendChild(p1);
                p1.innerHTML=data[i]["bookName"];
                var courier=document.createElement("span");
                courier.className="courier";
                courier.innerHTML="及时配发";
                p1.appendChild(courier);
                var infomation=document.createElement("ul");
                infomation.className="infomation";
                inifoDiv.appendChild(infomation);
                var author=document.createElement("li");
                author.className="author";
                author.innerHTML=data[i]["bookAuthor"];
                infomation.appendChild(author);
                var shu1=document.createElement("li");
                shu1.innerHTML="|";
                infomation.appendChild(shu1);
                var translate=document.createElement("li");
                translate.className="translate";
                translate.innerHTML=data[i]["bookTranslate"];
                infomation.appendChild(translate);
                var shu2=document.createElement("li");
                shu2.innerHTML="|";
                infomation.appendChild(shu2);
                var publish=document.createElement("li");
                publish.className="publish";
                publish.innerHTML=data[i]["bookPublish"];
                infomation.appendChild(publish);
                var shu3=document.createElement("li");
                shu3.innerHTML="|";
                infomation.appendChild(shu3);
                var number=document.createElement("li");
                number.className="number";
                number.innerHTML=data[i]["bookNumber"];
                infomation.appendChild(number);
                var shu4=document.createElement("li");
                shu4.innerHTML="|";
                infomation.appendChild(shu4);
                var time=document.createElement("li");
                time.className="time";
                time.innerHTML=data[i]["bookTime"];
                infomation.appendChild(time)
                var br=document.createElement("br");
                inifoDiv.appendChild(br);
                var p2=document.createElement("p");
                p2.className="evaluate";
                inifoDiv.appendChild(p2);
                var img1=document.createElement("img");
                img1.src="images/star_1.gif";
                p2.appendChild(img1);
                var img2=document.createElement("img");
                img2.src="images/star_1.gif";
                p2.appendChild(img2);
                var img3=document.createElement("img");
                img3.src="images/star_1.gif";
                p2.appendChild(img3);
                var img4=document.createElement("img");
                img4.src="images/star_1.gif";
                p2.appendChild(img4);
                var img5=document.createElement("img");
                img5.src="images/star_1.gif";
                p2.appendChild(img5);
                var spans=document.createElement("span");
                spans.className="font";
                spans.innerHTML=data[i]["evaluate"];
                spans.style.marginLeft="3px"
                p2.appendChild(spans);
                var p3=document.createElement("p");
                p3.className="vip";
                inifoDiv.appendChild(p3);
                var img6=document.createElement("img");
                img6.src="images/shu.png";
                img6.style.width="17px";
                p3.appendChild(img6);
                var vipin=document.createElement("span");
                vipin.className="vipin";
                vipin.innerHTML="vip价:";
                vipin.style.marginLeft="5px";
                p3.appendChild(vipin);
                var vipmoney=document.createElement("span");
                vipmoney.className="vipmoney";
                vipmoney.innerHTML=data[i]["vipmoney"];
                p3.appendChild(vipmoney);
                var no=document.createElement("span");
                no.className="no";
                no.innerHTML=data[i]["Vno"];
                p3.appendChild(no);
                var btn1=document.createElement("span");
                btn1.className="btn1";
                p3.appendChild(btn1);
                var img7=document.createElement("img");
                img7.src="images/result_buy.jpg";
                btn1.appendChild(img7);
                var img8=document.createElement("img");
                img8.src="images/result_tuan.jpg";
                btn1.appendChild(img8);
                var img9=document.createElement("img");
                img9.src="images/result_fav.jpg";
                btn1.appendChild(img9);
                var p4=document.createElement("p");
                p4.className="Ebook";
                inifoDiv.appendChild(p4);
                var img10=document.createElement("img");
                img10.src="images/shu.png";
                img10.style.width="17px";
                p4.appendChild(img10);
                var font=document.createElement("span");
                font.className="font";
                font.innerHTML="Ebook价:";
                font.style.marginLeft="5px";
                p4.appendChild(font);
                var vipmoney1=document.createElement("span");
                vipmoney1.className="vipmoney";
                vipmoney1.innerHTML=data[i]["Emoney"];
                p4.appendChild(vipmoney1);
                var no1=document.createElement("span");
                no1.className="no";
                no1.innerHTML=data[i]["Eno"];
                p4.appendChild(no1);
                var btn2=document.createElement("span");
                btn2.className="btn2";
                p4.appendChild(btn2);
                var img11=document.createElement("img");
                img11.src="images/result_buy.jpg";
                btn2.appendChild(img11);
                var img12=document.createElement("img");
                img12.src="images/result_tuan.jpg";
                btn2.appendChild(img12);
                var hr0=document.createElement("hr");
                hr0.style.width="810px";
                content.appendChild(hr0);

                img7.onclick=function () {
                    alert(1)
                }
            }
        }
    }
};


